﻿/*-------------------------------------------------------------------------
* 命名空间: MyToDo.ViewModels/ToDoViewModel
* 类       名: ToDoViewModel
* 功      能:  TD
* 时      间:  2023/12/14 11:31:48
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using MyToDo.Models;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyToDo.ViewModels
{
    public class ToDoViewModel : BindableBase
    {

        public ToDoViewModel()
        {
            ToDoList = new ObservableCollection<ToDoEntity>();
            InitToDoList();

            AddToDoCommand = new DelegateCommand(DoAddToDoCommand);
        }

        private void DoAddToDoCommand()
        {
            IsRightDrawerOpen = true;
        }

        private void InitToDoList()
        {
            for (int i = 1; i < 21; i++)
            {
                ToDoList!.Add(new ToDoEntity() { Title = "标题 " + i, Content = "测试数据" });
            }
        }


        public DelegateCommand AddToDoCommand { get; private set; }


        private bool isRightDrawerOpen;

        public bool IsRightDrawerOpen
        {
            get { return isRightDrawerOpen; }
            set
            {
                isRightDrawerOpen = value;
                RaisePropertyChanged();
            }
        }



        private ObservableCollection<ToDoEntity>? toDoList;

        public ObservableCollection<ToDoEntity>? ToDoList
        {
            get { return toDoList; }
            set
            {
                toDoList = value;
                RaisePropertyChanged();
            }
        }

    }
}
